package controller;

import db.ItemDAO;
import model.DuplicateItemIdentifierException;
import model.Item;
import model.ItemGroup;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;

/**
 * 
 * @author Mads Nielsen
 *
 */
public class ItemController {
    
    public void addItem(String name, String itemNo, double price, ItemGroup group,
            int minStock) throws DuplicateItemIdentifierException {
        
        Item item = new Item();
        item.setName(name);
        item.setItemNo(itemNo);
        item.setPrice(price);
        item.setGroup(group);
        item.setMinStock(minStock);
        
    }
    
    public Item getItem(String itemNo) {
        throw new NotImplementedException();
    }
    
    public void editItem(Item item, String newItemNo, String newItemName, Double newItemPrice, 
            ItemGroup newGroup, int newMinStock) {
        
        item.setItemNo(newItemNo);
        item.setName(newItemName);
        item.setPrice(newItemPrice);
        item.setGroup(newGroup);
        item.setMinStock(newMinStock);
        
    }

    public int getItemCount() {
        throw new UnsupportedOperationException("Not yet implemented");
    }

    public Item[] findItemsByName(String text) {
        text += "%";
        return new ItemDAO().findAll("name LIKE ?", text);
    }
}
